<template>
<div>
    
    <p :style="{background:bgColor}">{{bgfn()}}我是文字</p>

</div>
</template>

<script>
export default {
  data() {
    return {
      bgColor: null,
    };
  },
  methods: {
    fn(x, y) {
      return Math.floor(Math.random() * (x - y + 1) + y);
    },
    bgfn() {
      this.bgColor = `rgb(${this.fn(0, 255)},${this.fn(0, 255)},${this.fn(0,255)})`;
    },
  },
};
</script>

<style>
</style>